#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// On an arduino MEGA 2560: 20(SDA), 21(SCL)

#define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32


Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);


#define LOGO_HEIGHT   16
#define LOGO_WIDTH    16

static unsigned int i = 0;
static unsigned int j = 0;

static const unsigned char PROGMEM str_1[] =
{ 
0x12,0x00,0x12,0x00,0x27,0xF0,0x24,0x20,0x69,0x40,0xA1,0x00,0x25,0x40,0x25,0x20,
0x29,0x10,0x31,0x10,0x25,0x00,0x22,0x00

};

static const unsigned char PROGMEM str_2[] =
{ 
0x48,0x00,0x48,0x00,0xE4,0x0F,0x24,0x04,0x96,0x02,0x85,0x00,0xA4,0x02,0xA4,0x04,
0x94,0x08,0x8C,0x08,0xA4,0x00,0x44,0x00


};
static const unsigned char PROGMEM str_3[] =
{ 
0x04,0x08,0x3F,0xC0,0x08,0x33,0xE0,0x2F,0x20,0x2A,0x31,0x20,0x00,0x00,0xF0,0x40,
0x80,0x20,0x10,0xE0,0x00,0x00,0x00,0xC0

};
static const unsigned char PROGMEM str_4[] =
{ 
0x20,0x10,0xFC,0x03,0x10,0xCC,0x07,0xF4,0x04,0x54,0x8C,0x04,0x00,0x00,0x0F,0x02,
0x01,0x04,0x08,0x07,0x00,0x00,0x00,0x03
};

void setup() {
  Serial.begin(9600);
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;); // Don't proceed, loop forever
  }

  display.clearDisplay();
//  display.setTextSize(2);
//  display.setTextColor(WHITE);
//  
//  display.setCursor(0,0);
//  display.println("Welcome");
//  
//  display.setCursor(0,16);
//  display.println("Home");

  
  display.drawBitmap(0, 0, str_1, 16, 16, 1);
  display.drawBitmap(40, 0, str_2, 16, 16, 1);
  display.drawBitmap(80, 0, str_3, 16, 16, 1);
  display.drawBitmap(0, 30, str_4, 16, 16, 1);

  display.display();
  
//  display.startscrollright(0x00, 0x07);
//  delay(2000);
//  display.stopscroll();
//  delay(1000);
//  display.startscrollleft(0x00, 0x07);
//  delay(2000);
//  display.stopscroll();
//  delay(1000);    
//  display.startscrolldiagright(0x00, 0x07);
//  delay(2000);
//  display.startscrolldiagleft(0x00, 0x07);
//  delay(2000);
//  display.stopscroll();
//  delay(2000);

}
void loop()
{
}
